package com.isman.placeslist.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBHelper extends SQLiteOpenHelper {
	public static final String DATABASE_NAME = "lis-project.db";
    public static final int DATABASE_VERSION = 3;
    
	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
	       try {
	            db.execSQL("CREATE TABLE " + PeopleContent.TABLE_NAME + " (" + 
            			PeopleContent._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            			PeopleContent.PID 		+ " INTEGER UNIQUE," +
            			PeopleContent.PSTATUS	+ " INTEGER," +
            			PeopleContent.PMESSAGE + " TEXT," +
            			PeopleContent.PCREATEBY+ " TEXT," +
            			
            			PeopleContent.UID 		+ " INTEGER UNIQUE," +
            			PeopleContent.UNAME 	+ " TEXT," +
            			PeopleContent.UEMAIL	+ " TEXT UNIQUE," +
            			PeopleContent.UTELEPHONE + " TEXT," +
            			PeopleContent.UPICTURE + " BLOB" +
            			");");
//	          String[] str = {
//	            "INSERT INTO people VALUES(NULL,1001,'Isman Usoh','ichergoo@gmail.com',0812345678,'',1);" ,
//	            "INSERT INTO people VALUES(NULL,1002,'Ilhum Oiktte','dchergoo@gmail.com',0812345679,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1003,'Osuru Fukada','kvhergoo@gmail.com',0812345610,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1004,'นิลินิ เพชรมณี','hshergoo@gmail.com',0812345611,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1005,'อิลฮัม บือซา','lqhergoo@gmail.com',0812345612,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1006,'Asman Fusk','qssmhergoo@gmail.com','0812345613',NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1007,'Hagonon Dulk','ikkdhergoo@gmail.com',0812345614,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1008,'Jual Samlc','cfhergoo@gmail.com',0812345615,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1009,'Xoom Demo','badhergoo@gmail.com',0822345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1010,'มั้งมี ศรีสุข','grhergoo@gmail.com',0832345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1011,'ขยัน ซือสัตร','rvchergoo@gmail.com',0842345678,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1012,'Adum Smit','dishergoo@gmail.com',0852345678,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1013,'Goole mail','wdhergoo@gmail.com',0862345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1014,'Larry Smair','pshergoo@gmail.com',0872345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1015,'ประวิทย์ สินสม','tchergoo@gmail.com',0882345678,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1016,'Wijms Jdil','wiiergoo@gmail.com',0892345678,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1017,'Mas dk','eqergoo@gmail.com',0813345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1018,'มงคง ดีพร้อม','xzsergoo@gmail.com',0814345678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1019,'Hdks las','oghchergoo@gmail.com',0812545678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1020,'สุราพง คงมาดี','ncahergoo@gmail.com',0812645678,NULL,0);" ,
//	            "INSERT INTO people VALUES(NULL,1021,'เรียนดี สอบเก่ง','ochergoo@gmail.com',0812745678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1022,'สามารถ คงดี','ushergoo@gmail.com',0812395678,NULL,1);" ,
//	            "INSERT INTO people VALUES(NULL,1023,'Ludsc q','xdfhergoo@gmail.com',0812340478,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1024,'Aulac','xcdweergoo@gmail.com',0812340578,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1025,'Bulacast sys','qchergoo@gmail.com',0812340678,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1026,'Culacast sys','xwchergoo@gmail.com',0812340778,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1027,'Dulacast sys','xqwchergoo@gmail.com',0812340878,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1028,'Eulacast sys','rwchergoo@gmail.com',0812340978,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1029,'Fulacast sys','qwwechergoo@gmail.com',0812340078,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1030,'Gulacast sys','itychergoo@gmail.com',0812341078,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1031,'Hulacast sys','wecchergoo@gmail.com',0812342378,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1032,'Iulacast sys','sdcchergoo@gmail.com',0812343378,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1033,'Julacast sys','qochergoo@gmail.com',0812344378,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1034,'Bulac','xcdweergoo@gmail.com',0882330578,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1035,'Clac','acdweergoo@gmail.com', 0842240578,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1036,'Dulac','bcdweergoo@gmail.com',0852340578,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1037,'Eulac','ccdweergoo@gmail.com',08962350578,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1038,'Fulac','dcdweergoo@gmail.com',0892360571,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1039,'Gulac','fcdweergoo@gmail.com',0887340572,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1040,'Hulac','gcdweergoo@gmail.com',0834348573,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1041,'Iulac','hcdweergoo@gmail.com',0832905574,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1042,'Julac','jcdweergoo@gmail.com',0892412575,NULL,1);",
//	            "INSERT INTO people VALUES(NULL,1043,'Kulac','lcdweergoo@gmail.com',0872340576,NULL,1);",};

//	          for (String string : str) {
//				db.execSQL(string);
//	          }
	        } catch (Exception e) {
	            Log.v("LISProject", "exception in table created");
	        }
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
	      db.execSQL("DROP TABLE IF EXISTS " + PeopleContent.TABLE_NAME);
	      onCreate(db);

	}

}
